home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Source Code
/
Libraries
/
VideoToolbox 96.06.15
/
VideoToolboxSources
/
RestoreCluts.c
< prev
next >
Wrap
Text File
|
1995-07-26
|
2KB
|
47 lines
/*
RestoreCluts.c
Developing programs that modify the clut can be annoying, because one frequently
aborts the program for one reason or another and then faces an editing environment
in which text is hard to see because of the weird clut settings. No longer.
Somewhere near the beginning of your program insert the line:
AtExitToShell(RestoreCluts);
This requests that RestoreCluts() be run when you quit, even if
it's an abnormal exit, e.g. escape to shell from MacsBug.
(AtExitToShell is equivalent to the non-ANSI _atexit() routine provided
by the THINK C environment.)
CAUTION: the atexit(), and _atexit() routines should not be used in
MATLAB code resources. The reason is that they will only be invoked when MATLAB
exits, after your code resources have already been flushed, so you'll crash.
At this writing (7/1/95) it's safe to call AtExitToShell(), but it will have
no effect if MATLAB is true.
For reasons that I don't understand, Apple's RestoreDeviceClut doesn't seem to
do anything, even though my GDRestoreDeviceClut works fine.
HISTORY:
4/25/92 dgp wrote it. Why didn't I think of this sooner?
12/8/92 dgp simplified code, based on Apple's Snippet:
RestoreColorsSlam() in ColorReset.c.
12/9/92 dgp replaced call to Apple's RestoreDeviceClut by my GDRestoreDeviceClut,
since Apple's routine doesn't seem to do anything.
12/15/92 dgp Renamed to GDRestoreDeviceClut for consistentcy with
Apple's capitalization of RestoreDeviceClut.
2/22/93 dhb & dgp Converted for MATLAB
*/
#include "VideoToolbox.h"
//#include <Menus.h>
void RestoreCluts(void)
{
// RestoreDeviceClut(NULL); // Apple's version, restore all cluts
GDRestoreDeviceClut(NULL); // my version, restore all cluts
// Apple suggests making these two calls as well, to force redrawing of
// everything.
PaintBehind(NULL,GetGrayRgn());
DrawMenuBar();
}